<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LiquidFun: b2ContactListener Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LiquidFun
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classb2_contact_listener-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">b2ContactListener Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="b2_world_callbacks_8h_source.html">b2WorldCallbacks.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a35148fc56fb9eac12077200fbd928f65"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a35148fc56fb9eac12077200fbd928f65"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#a35148fc56fb9eac12077200fbd928f65">BeginContact</a> (<a class="el" href="classb2_contact.html">b2Contact</a> *contact)</td></tr>
<tr class="memdesc:a35148fc56fb9eac12077200fbd928f65"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when two fixtures begin to touch. <br/></td></tr>
<tr class="separator:a35148fc56fb9eac12077200fbd928f65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb3059058e5c47903a3947c2eef5826b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb3059058e5c47903a3947c2eef5826b"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#afb3059058e5c47903a3947c2eef5826b">EndContact</a> (<a class="el" href="classb2_contact.html">b2Contact</a> *contact)</td></tr>
<tr class="memdesc:afb3059058e5c47903a3947c2eef5826b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when two fixtures cease to touch. <br/></td></tr>
<tr class="separator:afb3059058e5c47903a3947c2eef5826b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb9deb8af4d5d1cffbe150913b086bf1"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#afb9deb8af4d5d1cffbe150913b086bf1">BeginContact</a> (<a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *particleSystem, <a class="el" href="structb2_particle_body_contact.html">b2ParticleBodyContact</a> *particleBodyContact)</td></tr>
<tr class="separator:afb9deb8af4d5d1cffbe150913b086bf1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab265d63bdd7908f4e00e6ef06f3c99f6"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#ab265d63bdd7908f4e00e6ef06f3c99f6">EndContact</a> (<a class="el" href="classb2_fixture.html">b2Fixture</a> *fixture, <a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *particleSystem, int32 index)</td></tr>
<tr class="separator:ab265d63bdd7908f4e00e6ef06f3c99f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a514865000359ffb1a099f7dee871faea"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#a514865000359ffb1a099f7dee871faea">BeginContact</a> (<a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *particleSystem, <a class="el" href="structb2_particle_contact.html">b2ParticleContact</a> *particleContact)</td></tr>
<tr class="separator:a514865000359ffb1a099f7dee871faea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75d45130bf779d2cb766e26da0e4836b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#a75d45130bf779d2cb766e26da0e4836b">EndContact</a> (<a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *particleSystem, int32 indexA, int32 indexB)</td></tr>
<tr class="separator:a75d45130bf779d2cb766e26da0e4836b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a416f85eb45a1099053402b15a19a7de0"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#a416f85eb45a1099053402b15a19a7de0">PreSolve</a> (<a class="el" href="classb2_contact.html">b2Contact</a> *contact, const <a class="el" href="structb2_manifold.html">b2Manifold</a> *oldManifold)</td></tr>
<tr class="separator:a416f85eb45a1099053402b15a19a7de0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd58ec96f7569b95eec65b8ca3f8013d"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classb2_contact_listener.html#acd58ec96f7569b95eec65b8ca3f8013d">PostSolve</a> (<a class="el" href="classb2_contact.html">b2Contact</a> *contact, const <a class="el" href="structb2_contact_impulse.html">b2ContactImpulse</a> *impulse)</td></tr>
<tr class="separator:acd58ec96f7569b95eec65b8ca3f8013d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Implement this class to get contact information. You can use these results for things like sounds and game logic. You can also get contact results by traversing the contact lists after the time step. However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step. </p>
<dl class="section warning"><dt>Warning</dt><dd>You cannot create/destroy Box2D entities inside these callbacks. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="afb9deb8af4d5d1cffbe150913b086bf1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::BeginContact </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *&#160;</td>
          <td class="paramname"><em>particleSystem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structb2_particle_body_contact.html">b2ParticleBodyContact</a> *&#160;</td>
          <td class="paramname"><em>particleBodyContact</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when a fixture and particle start touching if the b2_fixtureContactFilterParticle flag is set on the particle. </p>

</div>
</div>
<a class="anchor" id="a514865000359ffb1a099f7dee871faea"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::BeginContact </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *&#160;</td>
          <td class="paramname"><em>particleSystem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structb2_particle_contact.html">b2ParticleContact</a> *&#160;</td>
          <td class="paramname"><em>particleContact</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when two particles start touching if b2_particleContactFilterParticle flag is set on either particle. </p>

</div>
</div>
<a class="anchor" id="ab265d63bdd7908f4e00e6ef06f3c99f6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::EndContact </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_fixture.html">b2Fixture</a> *&#160;</td>
          <td class="paramname"><em>fixture</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *&#160;</td>
          <td class="paramname"><em>particleSystem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>index</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when a fixture and particle stop touching if the b2_fixtureContactFilterParticle flag is set on the particle. </p>

</div>
</div>
<a class="anchor" id="a75d45130bf779d2cb766e26da0e4836b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::EndContact </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_particle_system.html">b2ParticleSystem</a> *&#160;</td>
          <td class="paramname"><em>particleSystem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>indexA</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>indexB</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when two particles start touching if b2_particleContactFilterParticle flag is set on either particle. </p>

</div>
</div>
<a class="anchor" id="acd58ec96f7569b95eec65b8ca3f8013d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::PostSolve </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_contact.html">b2Contact</a> *&#160;</td>
          <td class="paramname"><em>contact</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structb2_contact_impulse.html">b2ContactImpulse</a> *&#160;</td>
          <td class="paramname"><em>impulse</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This lets you inspect a contact after the solver is finished. This is useful for inspecting impulses. Note: the contact manifold does not include time of impact impulses, which can be arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly in a separate data structure. Note: this is only called for contacts that are touching, solid, and awake. </p>

</div>
</div>
<a class="anchor" id="a416f85eb45a1099053402b15a19a7de0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void b2ContactListener::PreSolve </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classb2_contact.html">b2Contact</a> *&#160;</td>
          <td class="paramname"><em>contact</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structb2_manifold.html">b2Manifold</a> *&#160;</td>
          <td class="paramname"><em>oldManifold</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. disable contact). A copy of the old manifold is provided so that you can detect changes. Note: this is called only for awake bodies. Note: this is called even when the number of contact points is zero. Note: this is not called for sensors. Note: if you set the number of contact points to zero, you will not get an EndContact callback. However, you may get a BeginContact callback the next step. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="b2_world_callbacks_8h_source.html">b2WorldCallbacks.h</a></li>
</ul>
</div><!-- contents -->
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46159502-1', 'auto');
ga('create', 'UA-49880327-7', 'auto', {'name': 'liquidFunTracker'});
ga('send', 'pageview');
ga('liquidFunTracker.send', 'pageview');
</script>
</body>
</html>
